package com.ruoyi.web.controller.ring.app;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.bean.Builder;
import com.ruoyi.ring.domain.AppVersion;
import com.ruoyi.ring.service.IAppVersionService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 版本管理 app
 * 
 * @author liuwp
 * @date 2024-12-28
 */
@RestController
@RequestMapping("/ring/app/version")
public class AppRingVersionController extends BaseController
{
    @Resource
    private IAppVersionService appVersionService;

    /**
     * 获取对应平台最新版本 app
     * @param platform  安卓或者苹果  字典：app_release_platform
     * @return
     */
    @GetMapping("/query/{platform}")
    public AjaxResult query(@PathVariable("platform") Integer platform)
    {
        AppVersion appVersion = appVersionService.selectOneAppVersion(Builder.of(AppVersion::new).with(AppVersion::setPlatform, platform).build());
        return AjaxResult.success(appVersion);
    }
}
